package com.ruoyi.accounting.domain.dto;

import com.ruoyi.accounting.enums.ClassificationTypeEnum;
import com.ruoyi.accounting.validator.annotation.EnumValidator;
import com.ruoyi.accounting.validator.annotation.ExistBookId;
import com.ruoyi.accounting.validator.annotation.ExistClassificationId;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 分类对象 acc_classification
 *
 * @author ruoyi
 * @date 2025-07-12
 */
@Data
public class AccClassificationDTO extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    private Long id;

    /**
     * 账本id
     */
    @NotNull(message = "账本id不能为空")
    @ExistBookId
    private Long bookId;

    /**
     * 分类种类
     */
    @NotNull
    @EnumValidator(enumClass = ClassificationTypeEnum.class, message = "分类种类参数不合法")
    private Integer classificationType;

    /**
     * 父分类id
     */
    @ExistClassificationId(message = "父分类不存在")
    private Long parentId;

    /**
     * 分类名称
     */
    private String classificationName;

    /**
     * 图标链接
     */
    private String iconUrl;

    /**
     * 是否删除
     */
    private Integer delFlag;


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("bookId", getBookId())
                .append("classificationType", getClassificationType())
                .append("parentId", getParentId())
                .append("classificationName", getClassificationName())
                .append("iconUrl", getIconUrl())
                .append("updateTime", getUpdateTime())
                .append("createTime", getCreateTime())
                .append("delFlag", getDelFlag())
                .toString();
    }
}